home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / loadavg / RCS / loadAvg.h,v < prev    next >
Encoding:
Text File  |  1988-05-16  |  5.8 KB  |  320 lines

  1. head     2.7;
  2. access   ;
  3. symbols  ;
  4. locks    ; strict;
  5. comment  @ * @;
  6.  
  7.  
  8. 2.7
  9. date     88.05.15.21.01.24;  author douglis;  state Exp;
  10. branches ;
  11. next     2.6;
  12.  
  13. 2.6
  14. date     88.04.07.10.30.46;  author douglis;  state Exp;
  15. branches ;
  16. next     2.5;
  17.  
  18. 2.5
  19. date     88.03.17.22.43.04;  author douglis;  state Exp;
  20. branches ;
  21. next     2.4;
  22.  
  23. 2.4
  24. date     88.02.21.15.55.03;  author douglis;  state Exp;
  25. branches ;
  26. next     2.3;
  27.  
  28. 2.3
  29. date     87.11.20.12.41.29;  author douglis;  state Exp;
  30. branches ;
  31. next     2.2;
  32.  
  33. 2.2
  34. date     87.03.15.21.33.50;  author douglis;  state Exp;
  35. branches ;
  36. next     2.1;
  37.  
  38. 2.1
  39. date     87.03.11.18.12.46;  author douglis;  state Exp;
  40. branches ;
  41. next     2.0;
  42.  
  43. 2.0
  44. date     87.03.11.12.39.57;  author douglis;  state Exp;
  45. branches ;
  46. next     ;
  47.  
  48.  
  49. desc
  50. @Declarations internal to the loadAvg program.
  51. @
  52.  
  53.  
  54. 2.7
  55. log
  56. @changed to use the hostInfo C library routines and structures.
  57. @
  58. text
  59. @/*
  60.  * loadAvg.h --
  61.  *
  62.  *    Declarations internal to the loadAvg program.
  63.  *
  64.  * Copyright 1987 Regents of the University of California
  65.  * All rights reserved.
  66.  *
  67.  *
  68.  * $Header: loadAvg.h,v 2.6 88/04/07 10:30:46 douglis Exp $ SPRITE (Berkeley)
  69.  */
  70.  
  71. #ifndef _LOADAVG
  72. #define _LOADAVG
  73.  
  74. #include "sprite.h"
  75. #include "status.h"
  76. #include "io.h"
  77. #include "mem.h"
  78. #include "fs.h"
  79. #include "proc.h"
  80. #include "time.h"
  81. #include "byte.h"
  82. #include "dataBase.h"
  83. #include "hostInfo.h"
  84.  
  85. /*
  86.  * Define pseudo-RPC protocol for named pipes.
  87.  *
  88.  *    LA_RPC_UPDATE        - update load statistics for a node
  89.  *    LA_RPC_IDLE        - get an idle node
  90.  *    LA_RPC_ALLINFO        - output statistics for all nodes
  91.  */
  92.  
  93. #define LA_RPC_UPDATE 0
  94. #define LA_RPC_IDLE 1
  95. #define LA_RPC_ALL_INFO 2
  96.  
  97. #define LOAD_NUM_VALUES 3
  98.  
  99. /*
  100.  * Define constants related to Sprite system characteristics and defaults.
  101.  */
  102.  
  103. #define STANDARD_OUTPUT 1
  104. #define OPEN_MODE 0664
  105. #define MAX_NUM_HOSTS 256
  106.  
  107. /*
  108.  * A record contains "%2d %3d %10d %10d %3.0f %3.0f %3.0f %5.2f %5.2f %5.2f\n",
  109.  * plus a null byte.  (This amounts to 54 bytes.)  Make it the next
  110.  * power of 2.
  111.  *
  112.  * Note that after this is debugged, this can be changed to write in binary
  113.  * form rather than converting to ASCII.
  114.  */
  115.  
  116. #define UTIL_RECORD_SIZE 64
  117.  
  118. /*
  119.  * Subscripts into the queueThreshold array.
  120.  */
  121. #define MIN_THRESHOLD 0
  122. #define MAX_THRESHOLD 1
  123.  
  124. /*
  125.  * Arbitrary value larger than the load average on any node
  126.  */
  127. #define MAX_LOAD 1000.0
  128.  
  129.  
  130. /*
  131.  * For each machine, keep track of the timestamp for its information and the
  132.  * different load averages reported.   Also, the architecture type
  133.  * (e.g., sun2/sun3/spur) is stored to make sure we can migrate to a machine
  134.  * of the same type.
  135.  */
  136.  
  137. typedef struct {
  138.     int        hostID;
  139.     int        archType;
  140.     int        utils[LOAD_NUM_VALUES];
  141.     double    lengths[LOAD_NUM_VALUES];
  142.     int     bootTime;
  143.     int     timestamp;
  144.     int     noInput;
  145.     Boolean    allowMigration;
  146. } NodeInfo;
  147.  
  148. /*
  149.  * If we are not allowing foreign processes, but our time since last input
  150.  * is greater than noInput and our average queue lengths are ALL less than
  151.  * the corresponding values in min, start accepting foreign processes.
  152.  *
  153.  * If we are allowing foreign processes and either the idle time drops
  154.  * or ANY of the average queue lengths exceeds its corresponding value in max,
  155.  * stop accepting them.
  156.  */
  157.  
  158. typedef struct {
  159.     int        noInput;
  160.     double    min[LOAD_NUM_VALUES];
  161.     double    max[LOAD_NUM_VALUES];
  162. } Thresholds;
  163.  
  164. /*
  165.  * Global variables.  (Options, plus other global vars initialized at startup.)
  166.  */
  167.  
  168. extern Boolean debug;
  169. extern Boolean verbose;
  170. extern int loadInterval;
  171. extern int writeInterval;
  172. extern int timeOut;
  173. extern Boolean forkChild;
  174. extern Boolean lockFile;
  175. extern char *dataFile;
  176. extern char *weightString;
  177. extern double weights[];
  178. extern Thresholds thresholds;
  179.  
  180. extern int hostID;
  181. extern int archType;
  182. extern char *myName;
  183.  
  184. /*
  185.  * Procedures.
  186.  */
  187.  
  188. extern void RunDaemon();
  189. extern void RunServer();
  190. extern ReturnStatus OpenCreate();
  191.  
  192. #endif _LOADAVG
  193. @
  194.  
  195.  
  196. 2.6
  197. log
  198. @Removed references to "server" and using pipes, since that's obsolete.
  199. @
  200. text
  201. @d10 1
  202. a10 1
  203.  * $Header: loadAvg.h,v 2.5 88/03/17 22:43:04 douglis Exp $ SPRITE (Berkeley)
  204. d24 2
  205. @
  206.  
  207.  
  208. 2.5
  209. log
  210. @Added byte.h to include list.
  211. @
  212. text
  213. @d10 1
  214. a10 1
  215.  * $Header: loadAvg.h,v 2.4 88/02/21 15:55:03 douglis Exp $ SPRITE (Berkeley)
  216. a112 2
  217. extern Boolean useDataFile;
  218. extern Boolean usePipes;
  219. a114 3
  220. extern char *pipeDir;
  221. extern char *requestFile;
  222. extern char *responseFile;
  223. @
  224.  
  225.  
  226. 2.4
  227. log
  228. @just added myName global variable.
  229. @
  230. text
  231. @d10 1
  232. a10 1
  233.  * $Header: loadAvg.h,v 2.3 87/11/20 12:41:29 douglis Exp $ SPRITE (Berkeley)
  234. d23 1
  235. @
  236.  
  237.  
  238. 2.3
  239. log
  240. @Store the boottime and architecture type in the global file.
  241. @
  242. text
  243. @d10 1
  244. a10 1
  245.  * $Header: loadAvg.h,v 2.2 87/03/15 21:33:50 douglis Exp $ SPRITE (Berkeley)
  246. d126 1
  247. @
  248.  
  249.  
  250. 2.2
  251. log
  252. @Combined thresholds into a single structure.  Added getting random node.
  253. @
  254. text
  255. @d10 1
  256. a10 1
  257.  * $Header: loadAvg.h,v 2.1 87/03/11 18:12:46 douglis Exp $ SPRITE (Berkeley)
  258. d71 3
  259. a73 1
  260.  * different load averages reported.  
  261. d78 1
  262. d81 1
  263. d125 1
  264. @
  265.  
  266.  
  267. 2.1
  268. log
  269. @Keep track of whether to migrate processes based on load average
  270. and keyboard/mouse idle time.
  271. @
  272. text
  273. @d10 1
  274. a10 1
  275.  * $Header: proto.h,v 1.7 87/01/04 17:28:51 andrew Exp $ SPRITE (Berkeley)
  276. a35 9
  277. /*
  278.  * Define constants specific to load average statistics.
  279.  */
  280.  
  281. #define LOAD_INTERVAL 5
  282. #define WRITE_INTERVAL (60 * LOAD_INTERVAL)
  283. #define WEIGHT1 (double) 0.9200444146293232     /* exp(-1/12) */
  284. #define WEIGHT2 (double) 0.9834714538216174     /* exp(-1/60) */
  285. #define WEIGHT3 (double) 0.9944598480048967     /* exp(-1/180) */
  286. d84 16
  287. d104 1
  288. d107 1
  289. d118 1
  290. a118 2
  291. extern int inputThreshold;
  292. extern double queueThreshold[];
  293. @
  294.  
  295.  
  296. 2.0
  297. log
  298. @Initial revision.
  299. @
  300. text
  301. @d8 3
  302. a12 4
  303. #ifndef lint
  304. static char rcsid[] = "$Header: loadAvg.c,v 1.8 87/03/11 11:09:50 douglis Exp $ SPRITE (Berkeley)";
  305. #endif not lint
  306.  
  307. d41 1
  308. a41 1
  309. #define WRITE_INTERVAL (1 * LOAD_INTERVAL)
  310. d67 6
  311. d84 3
  312. a86 2
  313.     int            utils[LOAD_NUM_VALUES];
  314.     double        lengths[LOAD_NUM_VALUES];
  315. d89 1
  316. a100 1
  317. extern Boolean writeToStdOut;
  318. d109 2
  319. @
  320.